<template>
  <!-- 消息更多 -->
  <div class="page_padding">
    <MyNavBar @goback="goback" :title="title" />
    <div class="tab_con">
      <van-tabs @change="onChange" swipeable v-model="activeTab" sticky>
        <van-tab title="用户详情" name="1"></van-tab>
        <van-tab title="变更记录" name="2"></van-tab>
      </van-tabs>
      <user-info-detail v-if="activeTab === '1'"></user-info-detail>
      <div class="record" v-if="activeTab === '2'">
        <!--  v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoadList" -->
        <template v-if="recordList.length > 0">
          <van-list>
            <div class="record_li" v-for="item in recordList" :key="item.id">
              <div class="record_li_tit">
                {{ item.logContent }}
              </div>
              <div class="record_li_label">
                <span class="label_time">{{ item.createTime }}</span>
              </div>
            </div>
          </van-list>
        </template>
        <van-empty description="暂无数据" v-else></van-empty>
      </div>
    </div>
  </div>
</template>

<script>
import MyNavBar from '@com/MyNavBar'
import userInfoDetail from './components/userInfoDetail.vue'
import { listUserOperLog } from '@api/api-democratic.js'
export default {
  name: 'userDataChangeMsg',
  components: { MyNavBar, userInfoDetail },
  props: {},
  data() {
    return {
      title: '用户通知详情',
      activeTab: '1',
      id: this.$route.query.id,
      noticeId: this.$route.query.noticeId,
      userId: this.$route.query.userId,
      orgId: this.$route.query.orgId,
      recordList: [],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
    this.onLoadList()
  },
  methods: {
    goback() {
      this.$router.go(-1)
    },
    onChange(index) {},
    onLoadList() {
      listUserOperLog({
        oneParam: this.userId,
      })
        .then(res => {
          const data = res.data
          this.recordList.push(...data)
          /* this.recordTotalPages = data.totalSize;
          this.currentPage++;
          this.loading = false;
          if (this.recodeList.length === this.recordTotalPages) {
            this.finished = true;
          } */
        })
        .catch(err => {
          this.finished = true
        })
    },
  },
}
</script>

<style lang="scss" scoped>
.tab_con {
  width: 100%;
  background-color: #fff;
  z-index: 10;
  .van-tabs {
    border-bottom: 1px solid #f0f0f0;
  }
}
.detail {
  padding: 14px;
  background-color: #f0f0f0;
  font-size: 13px;
  color: #333333;
  .box {
    padding: 14px;
    background-color: #ffffff;
    border-radius: 5px;
    .box_title {
      font-size: 16px;
      color: #333;
      margin: 10px 0;
      font-weight: bold;
      .text {
        background-image: linear-gradient(#ffffff 50%, #f9f1e8);
      }
    }
    .box_info {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 0;
      border-bottom: 1px solid #efefef;
      .left {
        font-size: 14px;
      }
    }
  }
  .self_info {
    display: flex;
    .user_head {
      .iconfont {
        font-size: 12px0;
        color: #ccc;
      }
    }

    .user_info {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      color: #333;
      padding-left: 10px;

      .user_name {
        font-weight: bold;
        font-size: 16px;
        margin-bottom: 8px;
      }

      .user_post {
        font-size: 12px;
      }
    }
  }

  .login_info,
  .basic_info {
    margin-top: 14px;
  }
}
.record {
  padding: 14px;
  font-size: 13px;
  .record_li {
    display: flex;
    flex-direction: column;
    padding: 8px 5px;
    // border: 1px solid #efefef;
    // border-radius: 3px;
    margin-bottom: 8px;
    &:not(:last-of-type) {
      border-bottom: 2px solid #efefef;
    }
    .record_li_tit {
      font-size: 13px;
      color: #333333;
      margin-bottom: 8px;
    }
    .record_li_label {
      font-size: 12px;
      .label_type {
        color: #a57d60;
      }
      .label_line {
        color: #999999;
        margin: 0 8px;
      }
      .label_time {
        font-size: 12px;
        color: #999999;
      }
    }
  }
}
</style>
